﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TimKen.App;
using System.Data;

namespace TimKen.Web.Admin.Recommend {
    public partial class Recommend_Manage : AdminPage {

        private BussLogic.Recommend recommend = new TimKen.BussLogic.Recommend();

        protected void Page_Load(object sender, EventArgs e) {
            if (!IsPostBack) {
                BindData();
            }
        }

        protected void grdBrand_RowCommand(object sender, GridViewCommandEventArgs e) {
            int brandID = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "EditEvent") {
                Response.Redirect("Recommend_Add.aspx?RecommendID=" + brandID);
            }
            if (e.CommandName == "DeleteEvent") {
                recommend.Delete(brandID);
                BindData();
            }
        }

        private void BindData() {
            DataSet ds = recommend.GetList(1);
            this.grdRecommend.DataSource = ds;
            this.grdRecommend.DataBind();
        }

    }
}